home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / clang / netclb23.zip / EXAMPLES.EXE / VINFO.C < prev    next >
C/C++ Source or Header  |  1994-05-20  |  3KB  |  71 lines

  1. /***************************************************************************/
  2. /* File:             VINFO.C                                               */
  3. /*                                                                         */
  4. /* Function:         List information about all volumes on the default     */
  5. /*                   server.                                               */
  6. /*                                                                         */
  7. /* Usage:            vinfo                                                 */
  8. /*                                                                         */
  9. /* Functions Called: GetVolumeInfoWithNumber                               */
  10. /*                   GetPreferredConnectionID                              */
  11. /*                   GetDefaultConnectionID                                */
  12. /*                   GetPrimaryConnectionID                                */
  13. /*                   SetPreferredConnectionID                              */
  14. /*                   ISShellLoaded                                         */
  15. /*                                                                         */
  16. /***************************************************************************/
  17. #include <stdlib.h>
  18. #include <stdio.h>
  19. #include <string.h>
  20.  
  21. #include "netware.h"
  22.  
  23. void main( void )
  24. {
  25. int r;
  26. int i;
  27. char vname[17];
  28. unsigned int spb,tb,ab,tds,ads;
  29. int vir;
  30. int thisserver,prefserver;
  31.  
  32.    if (IsShellLoaded() != SUCCESS)
  33.    {
  34.       printf("*** No netware shell loaded ***\n");
  35.       return;
  36.    }
  37.  
  38.    if ((prefserver = GetPreferredConnectionID()) == 0)
  39.    {
  40.       if ((thisserver = GetDefaultConnectionID()) == 0)
  41.          thisserver = GetPrimaryConnectionID();
  42.       SetPreferredConnectionID( thisserver );
  43.    }
  44.    else
  45.       thisserver = prefserver;
  46.  
  47.    for(i=0;i<32;i++)
  48.    {
  49.          r=GetVolumeInfoWithNumber((byte)i,vname,
  50.                      &spb,&tb,&ab,&tds,&ads,&vir);
  51.          if (r != 0)
  52.             printf("GetVolumeInfoWithNumber failed %02.2x on Volume: %d\n",
  53.                    r,i);
  54.          else
  55.          if (strlen(vname)!=0)
  56.          {
  57.             printf("\nVolume %d:- %s\n",i,vname);
  58.              printf("             sectors per block: %u\n",spb);
  59.              printf("                  total blocks: %u\n",tb);
  60.              printf("              available blocks: %u\n",ab);
  61.              printf("         total directory slots: %u\n",tds);
  62.              printf("     available directory slots: %u\n",ads);
  63.              printf("           volume is removable:    %d\n",vir);
  64.          }
  65.    }
  66.  
  67.    if (thisserver != prefserver)   /* reset preferred server */
  68.       SetPreferredConnectionID( prefserver );
  69. }
  70.  
  71.